#pragma once

#include <vector>

#include "ListControl.h"
#include "PropertyRow.h"

namespace My {

class PEditor;

class PropertyList : public ListControl 
{	
	friend class PropertyRow;
private:
	PEditor &	m_Editor;
	int			m_ActiveRow;
protected:
	virtual void OnRowsChanged();
public:
	void SetActiveRow(int index);
	void SetValidActiveRow(int index);
public:
	PropertyList(PEditor & e);
	~PropertyList();
public:
	int GetActiveRow() const
		{ return m_ActiveRow; }
	PropertyRow * GetActiveRowPtr() const { 
		assert(m_ActiveRow != -1); 
		return static_cast<PropertyRow *>(GetRow(m_ActiveRow)); 
	}
public:
	virtual CRect Bounds() const;
public:
	virtual void HandlePaint(CDC * pDC, const CRect & r);
	virtual void HandleKeyDown(unsigned int key, unsigned int count, unsigned int flags);
	virtual void HandleLeftDown(unsigned int flags, const CPoint & p);
	virtual bool HandleCursor(unsigned int flags, const CPoint & p);
	virtual void HandleFocus();
	virtual void HandleUnfocus();
};

} // My